﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BT_BieuThuc_Nhom13.Expressions
{
    public class AdditiveExpr : BinaryExpr
    {
        public AdditiveExpr(Expression _expr1, Expression _expr2)
        {
            expr1 = _expr1;
            expr2 = _expr2;
        }

        public override double Evaluate(double x)
        {
            return expr1.Evaluate(x) + expr2.Evaluate(x);
        }

        protected override Expression CreateDerive()
        {
            return new AdditiveExpr(expr1.Derive(), expr2.Derive());
        }

        protected override string Operator()
        {
            return "+";
        }
    }
}
